﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Web;
using System.Web.UI.WebControls;
using System.Globalization;
using System.Threading;
using System.IO;

namespace SIGEE_v0._1.Util
{
    public class UserCode
    {
        public static void CargarCombo(DropDownList combo, DataTable dt, String text, String value)
        {
            try
            {
                DataRow row;
                DataTable dtm;
                dtm = dt.Clone();
                row = dtm.NewRow();
                row[text] = "SELECCIONE";
                row[value] = "0";
                dtm.Rows.Add(row);
                foreach (DataRow item in dt.Rows)
                {
                    row = dtm.NewRow();
                    row[text] = item[text];
                    row[value] = item[value];
                    dtm.Rows.Add(row);
                }
                combo.DataSource = dtm;
                combo.DataTextField = text;
                combo.DataValueField = value;
                combo.DataBind();
            }
            catch (Exception ex) { throw ex; }
        }
    }
}